<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/jquery-1.11.1.js"></script>
</head>
<body>
        <h1>hello json</h1>
    <button id="btn">发送ajax请求</button>

<script>

    $(function () {
        //获取btn 绑定单击事件
    $("#btn").click(function () {
        var user = {
            username:"lisi",
            password:"12346"
        }
        //发送ajax
        $.ajax({
            url:'/mvc/json/js3',
            data:JSON.stringify(user),
            type:'post',
            dataType:'json',
            contentType:'application/json;charset=utf-8',
            success:function (res) {
                    console.log(res)
            }
        })
    })
    })


</script>

</body>
</html>
